/*
 * @Description:
 * @Author: liyuhao
 * @Date: 2021-08-20 14:45:12
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2024-05-27 15:59:42
 */
import React from 'react'
import './index.less'
import ReportCard, { ReportCardProps } from '../ReportCard'

export interface CardRowProps {
  data: ReportCardProps[]
  count: number // 一行ReportCard的数量 为了补充占位
  handleRefresh:any
}

const CardRow: React.FC<CardRowProps> = props => {
  const { data, count, handleRefresh } = props
  const _data: ReportCardProps[] = [...data]
  if (data?.length < count) {
    for (let i = 0; i < count - data?.length; i++) {
      _data.push({
        id: `${count}-${i}`,
        style: { visibility: 'hidden' }
      })
    }
  }

  return (
    <div className='report-card-row'>
      {_data.map(v => (
        <ReportCard key={v.id} {...v} handleRefresh={handleRefresh} />
      ))}
    </div>
  )
}

export default CardRow
